<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OA协同办公系统</title>
 <link href="css/table.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
 <script type="text/javascript" src="js/openwindow.js"></script>
 <script src="js/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
 <script type="text/javascript">
 function selectUser(){
		var url="getGrouphome.action";
		openWindow(url,700,400);
	}
	
function getOldValue(){
	  var array = document.getElementById("array").value;
	  return array;
	}
	
function setValue(value){
	  document.getElementById("array").value = value;
	  var arr = eval(value);
	  var names = "";
	  var ids = "";
	  for(i=0;i<arr.length;i++){
	    ids =  ids + "," + arr[i].value;
	    names = names + "," + arr[i].name;
	  }
	  if(names.length>0){
	    names = names.substring(1);
	    ids =  ids.substring(1);
	  }
	  document.getElementById("names").value=names;
	  document.getElementById("ids").value=ids;
	}
	
function saveMemo(){
	var d12 =$("#d12").val();
	var content =$("#content").val();
	if(d12=='null' || d12==''){
		alert("请选择备忘日期");
		return;
	}
	if(content=='null' || content==''){
		alert("请填写工作类容");
		return;
	}
	$.post("saveMemo.action",$("form").serialize(),function(data){
			if(data=='success'){
				alert("操作成功！");
				window.close();
				window.opener.location.href="memoList.action";
			}else{
				alert("操作失败！");
			}
		});	
	
}	
 </script>
</head>
<body>
<table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
  <tbody>
  <tr>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
    <td style="background: url('image/wsoa_window_002.gif');"><table border="0" cellpadding="0" cellspacing="0">
      <tbody><tr>
        <td align="center" style="background: url('image/wsoa_window_002.gif');" width="10"><img src="image/center_19.gif"></td>
        <td align="center" style="background: url('image/wsoa_window_002.gif');"></td>
        <td> 个人办公 &gt; 备忘管理 &gt; 备忘录 &gt; <a href="memoSave.action">添加</a></td>
        </tr>
    </tbody>
    </table></td>
    <td style="background: url('image/wsoa_window_002.gif');" width="1"></td>
  </tr>
  <tr>
    <td style="background: url('image/wsoa_window_010.gif');"  width="1">&nbsp;</td>
    <td>
    <input type="hidden" id="array" >
    <form action="" method="post" name="saveMemoForm" id="saveMemoForm">
    <table width="100%" style="margin-top: 10px" class="table5 bgcolor5">
    	<tr><td  class="table5 bgcolor5" width="10%">日期</td>
    	<td class="table5" colspan="3">
    		<input readonly="readonly" onclick="WdatePicker()" class="Wdate" name="memo.memoDate" id="d12" type="text"/>
    	</td></tr>
    	<tr><td class="table5 bgcolor5">备忘人员</td><td class="table5" colspan="3">
    	<textarea readonly="readonly" id="names" name="names" style="width:95%;height:auto;">${names }</textarea><br/>
    	<input type="hidden" id="ids" name="memo.memoUserId" value="${users}">
    	<a href="javascript:selectUser()">添加联系人</a></td></tr>
    	<tr><td class="table5 bgcolor5">工作内容</td>
    	<td class="table5" colspan="3">
    		<textarea id="content" onpropertychange="if(this.value.length>200){this.value=this.value.substr(0,200)}" title="最多不超过200个字符" name="memo.content" style="width: 95%;height: 50px"></textarea>
    	 </td></tr>
    	<tr><td class="table5 bgcolor5">起草人</td>
    	<td width="40%" width="50px" class="table5">
    		${sessionScope.userInfo.name}
    		<input type="hidden" name="memo.myUserName" value="${sessionScope.userInfo.name }" />
    	</td><td width="10%" class="table5 bgcolor5" >起草时间</td>
    	<td width="100%" width="80px" class="table5">
    		<fmt:formatDate value="${memo.creationTime}" pattern="yyyy-MM-dd hh:mm"/>
    		<input type="hidden" name="memo.creationTime" value="<fmt:formatDate value="${memo.creationTime}" type="both"/>" />
    	</td></tr>
    </table>
    <p></p>
    <table align="center">
    <tr>
    	<td align="center" colspan="4"><input onclick="saveMemo()" class="button_02" value="保存" type="button" >&nbsp;<input class="button_02" type="button" value="关闭" onclick="window.close()" > </td></tr>
    </table>
    </form>
    </td>
<td style="background: url('image/wsoa_window_006.gif');"  width="1">&nbsp;</td></tr>
  <tr>
    <td height="1" width="1"><img src="image/wsoa_window_009.gif" height="16" width="14"></td>
    <td style="background: url('image/wsoa_window_008.gif');" height="1"></td>
    <td height="1" width="1"><img src="image/wsoa_window_007.gif" height="16" width="12"></td>
  </tr>
</tbody>
</table>
</body>
</html>